import tkinter as tk
import random

class application(tk.Frame):
    def __init__(self,master):
        self.master=master
        super(application, self).__init__(self.master)
        self.creatAPP()

    def creatAPP(self):
        self.b1=tk.Button(text='画圈',command=self.pc).pack()
        self.canvas=tk.Canvas(self.master,bg='pink',width=800,height=300)
        self.canvas.pack()
        line=self.canvas.create_line(10,10,20,30,40,50)
        area=self.canvas.create_rectangle(50,50,200,200)
        circle=self.canvas.create_oval(100,200,200,300)

    def pc(self):
        ls_x=list(x for x in range(800))
        ls_y=list(y for y in range(300))
        for i in range(5):
            x,y=random.choice(ls_x),random.choice(ls_y)
            self.canvas.create_oval(x,y,x+100,y+100)



window=tk.Tk()
window.geometry('1000x600')
app=application(window)
window.mainloop()